<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<base href="<%=basePath%>">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/css/bootstrap.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/css/main.css">
<script src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
<script src="${pageContext.request.contextPath}/js/main.js"></script>
<script src="http://cdn.bootcss.com/angular.js/1.4.5/angular.min.js"></script>
<title>代理商</title>
</head>

<body>
	<%@ include file="header.jsp"%>
	<%@ include file="left.jsp"%>
	<div id="index"
		style="position: absolute;left: 180px;top: 80px;bottom: 0;right: 0;">

		<style>
.main_div {
	min-width: 1000px;
	min-height: 60px
}

.force-overflow1-1 {
	border: none
}

.buttonPic>span {
	color: #FFFFFF;
	font-size: 36px
}
.pageChange {
	float: right;
	color: #337ab7;
}

.pageChange>span {
	cursor: pointer
}

.pageChange>span:hover {
	color: blue
}
</style>
		<section id="main">
			<div class="scrollbar1-1" id="style1-1">
				<div class="main_div">
					<div class="main_title">
						<span>财务明细</span>
					</div>
					<form class="form-inline"
						style="margin-top: 30px;margin-left: 20px">
						<div class="form-group">
							<label>处理状态:</label> <select id="dealType" class="form-control">
								<option value="-1">请选择</option>
								<option value="0">审核中</option>
								<option value="1">通过审核</option>
								<option value="2">审核失败</option>
							</select>
						</div>
						<button type="button" onclick="selectinfo()" class="btn btn-primary">查询</button>
					</form>
				</div>
				<div class="force-overflow1-1">
					<table class="table table-condensed table-bordered table-hover" id="showTable"
						show-filter="true" style="text-align: center">
						<tr style="background-color: #59c7d2">
							<th style="text-align: center">序号</th>
							<th style="text-align: center">提现金额</th>
							<th style="text-align: center">手续费</th>
							<th style="text-align: center">提交时间</th>
							<th style="text-align: center">审核时间</th>
							<th style="text-align: center">处理状态</th>
							<th style="text-align: center">提现总计</th>
							<th style="text-align: center">申请人</th>
						</tr>				
					</table>
					<div class="pageChange">
						<span onclick="prePage()">&nbsp;&nbsp;上一页&nbsp;&nbsp;</span> <span
							onclick="nextPage()">&nbsp;&nbsp;下一页&nbsp;&nbsp;</span> <em>
							&nbsp; 第&nbsp;<span id="pageNum">1</span>&nbsp;页&nbsp;&nbsp;
						</em> <em>/&nbsp;&nbsp;共&nbsp;<span id="totalpage"></span>&nbsp;页
						</em> <em>&nbsp;&nbsp;&nbsp;跳到第<input id="searchInput"
							style="width:46px" maxlength="4" type="text">页
						</em>
						<button class="btn btn-primary" onclick="searchPage()">搜索</button>
					</div>
					<input style="display:none" value="7" id="pageCount"
						name="pageCount" />
				</div>
			</div>
		</section>
	</div>
	<script>
		$(function() {
			selectinfo()
		})
	function selectinfo() {
			var dealType = $("#dealType").find("option:selected").val();
			var pageCount = $("#pageCount").val();
			var pageNum = $("#pageNum").html();
			if (dealType == "-1") {
				dealType = null;
			}
			$.post(urls+"agentAction/getAgentDrawings",
				{ 
				    typeId:2,
					merchantId: localStorage.getItem("agentid"),
					pageNum : pageNum,
					pageCount : pageCount,
					status : dealType
				},
				function(data) {
				console.log(data)
					if (data) {
						var totalpage = data.totalpage;
						var orderlist = data.drawingslist;
						var table = $("#showTable");
						$("tr").remove(".addtr");
						for (var i = 0; i < orderlist.length; i++) {
					    var status= orderlist[i].status;
					    if(status==0){
					    status="处理中"
					    }else if(status==1){
					    status="通过审核"
					    }else if(status==2){
					    status="审核失败"
					    };
						var checkTime = orderlist[i].checkTime;
						if (checkTime) {						   
						} else {
							checkTime="-"
						}
						var append = "<tr class='addtr'><td>" + (i + 1) + "</td>" +
							"<td>￥" + orderlist[i].withdrawMoney + "</td>" +
							"<td>￥" + orderlist[i].procedureMoney + "</td>" +
							"<td>" +  orderlist[i].submitTime + "</td>" +
							"<td>" + checkTime + "</td>" +
							"<td>" + status + "</td>" +
							"<td>￥" + orderlist[i].totalAmount + "</td>" +
							"<td>" + orderlist[i].withdrawPeople + "</td></tr>";
						table.append(append);
					}
						$("#totalpage").html(totalpage);
					}
				}
				, "json"
			)
		}
	</script>
</body>
</html>
